from selenium import webdriver
from time import sleep
bro = webdriver.Chrome(executable_path="./chromedriver")

bro.get('https://www.taobao.com/')

#标签定位
serach_input = bro.find_element_by_id('q')
#标签交互
serach_input.send_keys('Iphone')

#执行一组js程序
bro.execute_script('window.scrollTo(0,document.body.scrollHeight)')
sleep(2)

#点击搜索按钮
btn = bro.find_element_by_css_selector('.btn-search')
btn.click()

bro.get('https://www.baidu.com')
sleep(2)
bro.back()#回退
sleep(2)
bro.forward()#前进

sleep(2)

bro.quit()
